package com.acwing.partition11;

import java.io.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author `RKC`
 * @date 2021/12/19 9:32
 */
public class AC1064小国王 {

    private static final int N = 12, K = N * N;
    //f[i][j][k]表示考虑前i行，已经放置了j个国王，且当前行i的状态是k的合法方案数
    private static long[][][] f = new long[N][K][1 << N];
    private static Map<Integer, List<Integer>> stm = new HashMap<>();

    private static int n = 0, k = 0;

    private static final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    private static final BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) throws IOException {
        String[] ss = reader.readLine().split(" ");
        n = Integer.parseInt(ss[0]);
        k = Integer.parseInt(ss[1]);
        writer.write(resolve() + "\n");
        writer.flush();
    }

    private static long resolve() {
        //预处理单行可能的所有状态
        for (int i = 0; i < 1 << n; i++) {
            if ((i & (i << 1)) == 0) stm.put(i, new ArrayList<>());
        }
        //在当前行合法的基础上枚举出上一行的合法状态
        for (int cur : stm.keySet()) {
            List<Integer> stv = stm.get(cur);
            for (int pre : stm.keySet()) {
                int st = cur | pre;
                //相邻两行不能有同位的1，并且两行状态的或运算也不能包含两个相邻的1
                if ((cur & pre) == 0 && (st & (st << 1)) == 0) stv.add(pre);
            }
        }
        f[0][0][0] = 1;
        for (int i = 1; i <= n + 1; i++) {
            for (int j = 0; j <= k; j++) {
                for (Map.Entry<Integer, List<Integer>> entry : stm.entrySet()) {
                    int cur = entry.getKey(), cnt = bitCount(cur, n);
                    f[i & 1][j][cur] = 0;
                    for (int pre : entry.getValue()) {
                        if (j < cnt) continue;
                        f[i & 1][j][cur] += f[i - 1 & 1][j - cnt][pre];
                    }
                }
            }
        }
        return f[n + 1 & 1][k][0];
    }

    private static int bitCount(int num, int n) {
        int res = 0;
        for (int i = 0; i < n; i++) res += num >> i & 1;
        return res;
    }
}
